#include "band.h"
void help();
int main(int args,char *argv[]) 
{
    band bands;
    bands.FindFermiEnergy();
    for(int i=1;i<args;i++){
        if(argv[i][0]!='-') continue;
        switch(argv[i][1]){
            case 'a':
            case 'A':
                i++;
                sscanf(argv[i],"%f",&Latt<float>::ERROR);
                break;
            case 'e':
            case 'E':
                i++;
                float data;
                sscanf(argv[i],"%f",&data);
                bands.SetFermiEnergy(data);
                break;
            case 'g':
            case 'G':
                i++;
                sscanf(argv[i],"%d",&bands.gnuplot);
                break;
            case 'h':
            case 'H':
                help();
                exit(0);
            case 'i':
            case 'I':
                i++;
                sscanf(argv[i],"%f",&bands.increase);
                break;
            case 'p':
            case 'P':
                i++;
                sscanf(argv[i],"%d",&bands.plots);
                break;
            case 'r':
            case 'R':
                i++;
                sscanf(argv[i],"%f",&bands.range[0]);
                if(!sscanf(argv[i+1],"%f",&bands.range[1])){
                    bands.range[1]=-bands.range[0];
                }else{
                    i++;
                }
                if(bands.range[0]>bands.range[1])
                    std::swap(bands.range[0],bands.range[1]);
                break;
            case 's':
            case 'S':
                bands.ShowHSP();
                break;

        }
    }
    if(!bands.init()) return 0;
    bands.output();
    if(bands.gnuplot){
        bands.Gnuplot();
    }



    return 0;
}

void help()
{
printf("\
-h help\n\
-a set error for check float data equal\n\
-e set fermi energy (default: get E-fermi from doscar or outcar)\n\
-g write 'bandplot.plt' or not (0 or 1 default: 1)\n\
-i energy increment in gnuplot (float default: 1.0)\n\
-p figure number in gnuplot (1 or 2 default: 1)\n\
-r energy range shown in gnuplot\n\
-s show high symmetry points\n\
");
}